<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>注册信息</title>
    <style>
        body{width:1200px;height:600px;background: url("imgs/p1.jpg")}
        #z{width: 250px;height: 400px;
            align-self: center;
            margin-left: 600px;margin-top: 200px;
            color: coral;}
        p{align-content: center}
        h2{margin-left: 80px;margin-top: 0px;margin-bottom: 30px;}
    </style>
</head>
----------------------------------------
<body>
<div id="z">
    <?php
    //输出注册页面输入的所有个人信息
    session_start();
    header("Content-Type: text/html;charset=utf-8");
    //获取POST请求
    if($_SERVER['REQUEST_METHOD']=='POST') {
        //获取用户名
        $_SESSION['textfield'] = $_POST["textfield"];
        if($_SESSION['textfield']==""){                  //如果姓名为空
            echo"<script>alert('用户名不能为空，请输入姓名！')</script>";   //弹出消息框提示
            exit;     //程序中断，不再向下执行
        }
        //获取密码
        $_SESSION['password'] = $_POST["password"];
        if ($_SESSION['password']=="")
        {
            echo "<script>alert('密码不能为空，请输入密码! ')</script>";
            exit;
        }
        //获取电子邮件
        $_SESSION['email'] = $_POST["email"];
        if ($_SESSION['email']=="") {
            echo "<script>alert('电子邮件不能为空！')</script>";
            exit;
        }
        //获取电话号码
    $_SESSION['textfield2'] = $_POST["textfield2"];
    if ($_SESSION['textfield2']=="") {
            echo "<script>alert('电话号码不能为空！')</script>";
            exit;
        }
        $_SESSION['sex']= $_POST["sex"];//获取性别
        $_SESSION['select'] = $_POST["select"];//获取地址
        $_SESSION['select2'] = $_POST["select2"];//获取爱好
        //获取身份证号码
        $_SESSION['textfield3'] = $_POST["textfield3"];
    if ($_SESSION['textfield3']=="") {
            echo "<script>alert('身份证号码不能为空！')</script>";
            exit;
        }
    }
    //输出获得的所有信息
    echo $_SESSION['textfield'] ."您好"."</br>"."</br>";
    echo "您的性别是：". $_SESSION['sex']."</br>"."</br>";
    echo "您的密码是：".$_SESSION['password']."</br>"."</br>";
    echo "您的邮箱是：". $_SESSION['email']."</br>"."</br>";
    echo "您的电话号码是：". $_SESSION['textfield2']."</br>"."</br>";
    echo "您现在居住在：". $_SESSION['select']."</br>"."</br>";
    echo "您的爱好是：". $_SESSION['select2']."</br>"."</br>";
    echo "您的身份证号是：".$_SESSION['textfield3']."</br>"."</br>";
    ?>
    <form  method="post" action="denlu.php">
        <input type="submit" name="submit" id="submit" value="去登录">
    </form>
</div>
</body>
</html>

